package com.info.zhiduoduo.repository.mapper.company;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.dto.maker.MakerIntroDto;
import com.info.zhiduoduo.repository.entity.company.CompanyUser;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author TerryJ
 * @since 2018-12-08
 */
public interface CompanyUserMapper extends BaseMapper<CompanyUser> {

	@Select(" select u.userid,u.avatar,us.username,us.studionickname,ua.realname,us.intro," +
			" us.specialinvoice,us.invoicescope,us.fieldid,sf.fieldname,ua.opening_location " +
			" from zdd_company_user cu " +
			" join zdd_maker u on u.userid = cu.userid " +
			" join zdd_maker_studio us on us.userid = u.userid " +
			" join zdd_maker_account ua on ua.userid = u.userid " +
			" left join zdd_studio_field sf on sf.fieldid = us.fieldid " +
			" where cu.compid = #{compid}" +
			" and concat(u.nickname,us.username,us.studionickname,ua.realname) like '%${username}%' " +
			" and u.state != 4")
	List<MakerIntroDto> getCompUserList(@Param("compid") Integer compid, @Param("username") String username);
}
